<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
  Class: ActiveFedora::RelsInt::Datastream
  
    &mdash; Documentation by YARD 0.8.2.1
  
</title>

  <link rel="stylesheet" href="../../css/style.css" type="text/css" media="screen" charset="utf-8" />

  <link rel="stylesheet" href="../../css/common.css" type="text/css" media="screen" charset="utf-8" />

<script type="text/javascript" charset="utf-8">
  hasFrames = window.top.frames.main ? true : false;
  relpath = '../../';
  framesUrl = "../../frames.html#!" + escape(window.location.href);
</script>


  <script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>

  <script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>


  </head>
  <body>
    <div id="header">
      <div id="menu">
  
    <a href="../../_index.html">Index (D)</a> &raquo;
    <span class='title'><span class='object_link'><a href="../../ActiveFedora.html" title="ActiveFedora (module)">ActiveFedora</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../RelsInt.html" title="ActiveFedora::RelsInt (module)">RelsInt</a></span></span>
     &raquo; 
    <span class="title">Datastream</span>
  

  <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
</div>

      <div id="search">
  
    <a class="full_list_link" id="class_list_link"
        href="../../class_list.html">
      Class List
    </a>
  
    <a class="full_list_link" id="method_list_link"
        href="../../method_list.html">
      Method List
    </a>
  
    <a class="full_list_link" id="file_list_link"
        href="../../file_list.html">
      File List
    </a>
  
</div>
      <div class="clear"></div>
    </div>

    <iframe id="search_frame"></iframe>

    <div id="content"><h1>Class: ActiveFedora::RelsInt::Datastream
  
  
  
</h1>

<dl class="box">
  
    <dt class="r1">Inherits:</dt>
    <dd class="r1">
      <span class="inheritName">Datastream</span>
      
        <ul class="fullTree">
          <li>Object</li>
          
            <li class="next">Datastream</li>
          
            <li class="next">ActiveFedora::RelsInt::Datastream</li>
          
        </ul>
        <a href="#" class="inheritanceTree">show all</a>
      
      </dd>
    
  
  
    
  
    
  
  
  
    <dt class="r2 last">Defined in:</dt>
    <dd class="r2 last">/Users/ba2213/Github/cul/active_fedora_relsint/lib/active_fedora_relsint/datastream.rb</dd>
  
</dl>
<div class="clear"></div>





  <h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
  <ul class="summary">
    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#relationships_loaded-instance_method" title="#relationships_loaded (instance method)">- (Object) <strong>relationships_loaded</strong> </a>
    

    
  </span>
  
  
  
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Returns the value of attribute relationships_loaded.</p>
</div></span>
  
</li>

    
  </ul>




  
    <h2>
      Class Method Summary
      <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
    </h2>

    <ul class="summary">
      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#xml_template-class_method" title="xml_template (class method)">+ (Object) <strong>xml_template</strong> </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
    </ul>
  
    <h2>
      Instance Method Summary
      <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
    </h2>

    <ul class="summary">
      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#add_relationship-instance_method" title="#add_relationship (instance method)">- (Object) <strong>add_relationship</strong>(datastream, predicate, target, literal = false) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#build_statement-instance_method" title="#build_statement (instance method)">- (Object) <strong>build_statement</strong>(datastream, predicate, object, literal = false) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#clear_relationship-instance_method" title="#clear_relationship (instance method)">- (Object) <strong>clear_relationship</strong>(datastream, predicate) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#content-instance_method" title="#content (instance method)">- (Object) <strong>content</strong> </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#content%3D-instance_method" title="#content= (instance method)">- (Object) <strong>content=</strong>(new_content) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#from_solr-instance_method" title="#from_solr (instance method)">- (Object) <strong>from_solr</strong>(solr_doc) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#graph-instance_method" title="#graph (instance method)">- (Object) <strong>graph</strong> </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#load_relationships-instance_method" title="#load_relationships (instance method)">- (Object) <strong>load_relationships</strong> </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#relationships-instance_method" title="#relationships (instance method)">- (Object) <strong>relationships</strong>(*args) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#relationships_will_change%21-instance_method" title="#relationships_will_change! (instance method)">- (Object) <strong>relationships_will_change!</strong> </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#remove_relationship-instance_method" title="#remove_relationship (instance method)">- (Object) <strong>remove_relationship</strong>(datastream, predicate, target, literal = false) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#serialize%21-instance_method" title="#serialize! (instance method)">- (Object) <strong>serialize!</strong> </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#solrize_relationships-instance_method" title="#solrize_relationships (instance method)">- (Object) <strong>solrize_relationships</strong>(solr_doc = Hash.new) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#to_predicate-instance_method" title="#to_predicate (instance method)">- (Object) <strong>to_predicate</strong>(arg) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#to_rels_int-instance_method" title="#to_rels_int (instance method)">- (Object) <strong>to_rels_int</strong> </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#to_resource-instance_method" title="#to_resource (instance method)">- (Object) <strong>to_resource</strong>(object, literal = false) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#to_solr-instance_method" title="#to_solr (instance method)">- (Object) <strong>to_solr</strong>(solr_doc = Hash.new) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
    </ul>
  


  
  <div id="instance_attr_details" class="attr_details">
    <h2>Instance Attribute Details</h2>
    
      
      <span id="relationships_loaded=-instance_method"></span>
      <div class="method_details first">
  <h3 class="signature first" id="relationships_loaded-instance_method">
  
    - (<tt>Object</tt>) <strong>relationships_loaded</strong> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Returns the value of attribute relationships_loaded</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


5
6
7</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File '/Users/ba2213/Github/cul/active_fedora_relsint/lib/active_fedora_relsint/datastream.rb', line 5</span>

<span class='kw'>def</span> <span class='id identifier rubyid_relationships_loaded'>relationships_loaded</span>
  <span class='ivar'>@relationships_loaded</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
  </div>


  <div id="class_method_details" class="method_details_list">
    <h2>Class Method Details</h2>

    
      <div class="method_details first">
  <h3 class="signature first" id="xml_template-class_method">
  
    + (<tt>Object</tt>) <strong>xml_template</strong> 
  

  

  
</h3><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


115
116
117</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File '/Users/ba2213/Github/cul/active_fedora_relsint/lib/active_fedora_relsint/datastream.rb', line 115</span>

<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_xml_template'>xml_template</span>
  <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>&lt;rdf:RDF xmlns:rdf=\&quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#\&quot;&gt;&lt;/rdf:RDF&gt;</span><span class='tstring_end'>&quot;</span></span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

  <div id="instance_method_details" class="method_details_list">
    <h2>Instance Method Details</h2>

    
      <div class="method_details first">
  <h3 class="signature first" id="add_relationship-instance_method">
  
    - (<tt>Object</tt>) <strong>add_relationship</strong>(datastream, predicate, target, literal = false) 
  

  

  
</h3><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


64
65
66
67
68</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File '/Users/ba2213/Github/cul/active_fedora_relsint/lib/active_fedora_relsint/datastream.rb', line 64</span>

<span class='kw'>def</span> <span class='id identifier rubyid_add_relationship'>add_relationship</span><span class='lparen'>(</span><span class='id identifier rubyid_datastream'>datastream</span><span class='comma'>,</span> <span class='id identifier rubyid_predicate'>predicate</span><span class='comma'>,</span> <span class='id identifier rubyid_target'>target</span><span class='comma'>,</span> <span class='id identifier rubyid_literal'>literal</span><span class='op'>=</span><span class='kw'>false</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_stmt'>stmt</span> <span class='op'>=</span> <span class='id identifier rubyid_build_statement'>build_statement</span><span class='lparen'>(</span><span class='id identifier rubyid_datastream'>datastream</span><span class='comma'>,</span> <span class='id identifier rubyid_predicate'>predicate</span><span class='comma'>,</span> <span class='id identifier rubyid_target'>target</span><span class='comma'>,</span> <span class='id identifier rubyid_literal'>literal</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_graph'>graph</span><span class='period'>.</span><span class='id identifier rubyid_insert'>insert</span><span class='lparen'>(</span><span class='id identifier rubyid_stmt'>stmt</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_graph'>graph</span><span class='period'>.</span><span class='id identifier rubyid_has_statement?'>has_statement?</span> <span class='id identifier rubyid_stmt'>stmt</span>
  <span class='id identifier rubyid_relationships_will_change!'>relationships_will_change!</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="build_statement-instance_method">
  
    - (<tt>Object</tt>) <strong>build_statement</strong>(datastream, predicate, object, literal = false) 
  

  

  
</h3><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


57
58
59
60
61
62</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File '/Users/ba2213/Github/cul/active_fedora_relsint/lib/active_fedora_relsint/datastream.rb', line 57</span>

<span class='kw'>def</span> <span class='id identifier rubyid_build_statement'>build_statement</span><span class='lparen'>(</span><span class='id identifier rubyid_datastream'>datastream</span><span class='comma'>,</span> <span class='id identifier rubyid_predicate'>predicate</span><span class='comma'>,</span> <span class='id identifier rubyid_object'>object</span><span class='comma'>,</span> <span class='id identifier rubyid_literal'>literal</span><span class='op'>=</span><span class='kw'>false</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_subject'>subject</span> <span class='op'>=</span> <span class='id identifier rubyid_to_resource'>to_resource</span><span class='lparen'>(</span><span class='id identifier rubyid_datastream'>datastream</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_predicate'>predicate</span> <span class='op'>=</span> <span class='id identifier rubyid_to_predicate'>to_predicate</span><span class='lparen'>(</span><span class='id identifier rubyid_predicate'>predicate</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_object'>object</span> <span class='op'>=</span> <span class='id identifier rubyid_to_resource'>to_resource</span><span class='lparen'>(</span><span class='id identifier rubyid_object'>object</span><span class='comma'>,</span><span class='id identifier rubyid_literal'>literal</span><span class='rparen'>)</span>
  <span class='const'>RDF</span><span class='op'>::</span><span class='const'>Statement</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_subject'>subject</span><span class='comma'>,</span><span class='id identifier rubyid_predicate'>predicate</span><span class='comma'>,</span><span class='id identifier rubyid_object'>object</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="clear_relationship-instance_method">
  
    - (<tt>Object</tt>) <strong>clear_relationship</strong>(datastream, predicate) 
  

  

  
</h3><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


76
77
78
79</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File '/Users/ba2213/Github/cul/active_fedora_relsint/lib/active_fedora_relsint/datastream.rb', line 76</span>

<span class='kw'>def</span> <span class='id identifier rubyid_clear_relationship'>clear_relationship</span><span class='lparen'>(</span><span class='id identifier rubyid_datastream'>datastream</span><span class='comma'>,</span> <span class='id identifier rubyid_predicate'>predicate</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_graph'>graph</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='lbracket'>[</span><span class='id identifier rubyid_to_resource'>to_resource</span><span class='lparen'>(</span><span class='id identifier rubyid_datastream'>datastream</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_predicate'>predicate</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='rbracket'>]</span>
  <span class='id identifier rubyid_relationships_will_change!'>relationships_will_change!</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="content-instance_method">
  
    - (<tt>Object</tt>) <strong>content</strong> 
  

  

  
</h3><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


18
19
20
21
22
23
24</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File '/Users/ba2213/Github/cul/active_fedora_relsint/lib/active_fedora_relsint/datastream.rb', line 18</span>

<span class='kw'>def</span> <span class='id identifier rubyid_content'>content</span>
  <span class='kw'>if</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_new?'>new?</span> <span class='kw'>and</span> <span class='ivar'>@content</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
    <span class='id identifier rubyid_content'>content</span><span class='op'>=</span><span class='const'>ActiveFedora</span><span class='op'>::</span><span class='const'>RelsInt</span><span class='op'>::</span><span class='const'>Datastream</span><span class='period'>.</span><span class='id identifier rubyid_xml_template'>xml_template</span>
  <span class='kw'>else</span>
    <span class='kw'>super</span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="content=-instance_method">
  
    - (<tt>Object</tt>) <strong>content=</strong>(new_content) 
  

  

  
</h3><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


26
27
28
29
30</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File '/Users/ba2213/Github/cul/active_fedora_relsint/lib/active_fedora_relsint/datastream.rb', line 26</span>

<span class='kw'>def</span> <span class='id identifier rubyid_content='>content=</span> <span class='id identifier rubyid_new_content'>new_content</span>
  <span class='kw'>super</span>
  <span class='id identifier rubyid_relationships_loaded'>relationships_loaded</span><span class='op'>=</span><span class='kw'>false</span>
  <span class='id identifier rubyid_load_relationships'>load_relationships</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="from_solr-instance_method">
  
    - (<tt>Object</tt>) <strong>from_solr</strong>(solr_doc) 
  

  

  
</h3><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


125
126
127</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File '/Users/ba2213/Github/cul/active_fedora_relsint/lib/active_fedora_relsint/datastream.rb', line 125</span>

<span class='kw'>def</span> <span class='id identifier rubyid_from_solr'>from_solr</span><span class='lparen'>(</span><span class='id identifier rubyid_solr_doc'>solr_doc</span><span class='rparen'>)</span>
  <span class='ivar'>@solr_hash</span> <span class='op'>=</span> <span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_solr_doc'>solr_doc</span><span class='lbracket'>[</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_profile_solr_name'>profile_solr_name</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="graph-instance_method">
  
    - (<tt>Object</tt>) <strong>graph</strong> 
  

  

  
</h3><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


103
104
105</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File '/Users/ba2213/Github/cul/active_fedora_relsint/lib/active_fedora_relsint/datastream.rb', line 103</span>

<span class='kw'>def</span> <span class='id identifier rubyid_graph'>graph</span>
  <span class='ivar'>@graph</span> <span class='op'>||=</span> <span class='id identifier rubyid_load_relationships'>load_relationships</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="load_relationships-instance_method">
  
    - (<tt>Object</tt>) <strong>load_relationships</strong> 
  

  

  
</h3><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


92
93
94
95
96
97
98
99
100
101</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File '/Users/ba2213/Github/cul/active_fedora_relsint/lib/active_fedora_relsint/datastream.rb', line 92</span>

<span class='kw'>def</span> <span class='id identifier rubyid_load_relationships'>load_relationships</span>
  <span class='comment'># load from content
</span>  <span class='id identifier rubyid_g'>g</span> <span class='op'>=</span> <span class='const'>RDF</span><span class='op'>::</span><span class='const'>Graph</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
  <span class='const'>RDF</span><span class='op'>::</span><span class='const'>RDFXML</span><span class='op'>::</span><span class='const'>Reader</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_content'>content</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_stmt'>stmt</span><span class='op'>|</span>
    <span class='id identifier rubyid_g'>g</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_stmt'>stmt</span>
  <span class='kw'>end</span>
  <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_relationships_loaded'>relationships_loaded</span> <span class='op'>=</span> <span class='kw'>true</span>
  <span class='id identifier rubyid_changed_attributes'>changed_attributes</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>relationships</span><span class='tstring_end'>'</span></span>
  <span class='ivar'>@graph</span> <span class='op'>=</span> <span class='id identifier rubyid_g'>g</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="relationships-instance_method">
  
    - (<tt>Object</tt>) <strong>relationships</strong>(*args) 
  

  

  
</h3><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


81
82
83
84
85
86
87
88
89
90</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File '/Users/ba2213/Github/cul/active_fedora_relsint/lib/active_fedora_relsint/datastream.rb', line 81</span>

<span class='kw'>def</span> <span class='id identifier rubyid_relationships'>relationships</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_q_args'>q_args</span> <span class='op'>=</span> <span class='id identifier rubyid_args'>args</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span> <span class='op'>?</span> <span class='lbracket'>[</span><span class='symbol'>:s</span><span class='comma'>,</span> <span class='symbol'>:p</span><span class='comma'>,</span> <span class='symbol'>:o</span><span class='rbracket'>]</span> <span class='op'>:</span> <span class='lbracket'>[</span><span class='id identifier rubyid_to_resource'>to_resource</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_to_predicate'>to_predicate</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='lbracket'>[</span><span class='int'>2</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='symbol'>:o</span><span class='rparen'>)</span><span class='rbracket'>]</span>
  <span class='id identifier rubyid_query'>query</span> <span class='op'>=</span> <span class='const'>RDF</span><span class='op'>::</span><span class='const'>Query</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_query'>query</span><span class='op'>|</span>
    <span class='id identifier rubyid_query'>query</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_q_args'>q_args</span>
  <span class='kw'>end</span>
  <span class='id identifier rubyid_query'>query</span><span class='period'>.</span><span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='id identifier rubyid_graph'>graph</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='symbol'>:to_hash</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_hash'>hash</span><span class='op'>|</span>
    <span class='id identifier rubyid_stmt'>stmt</span> <span class='op'>=</span> <span class='id identifier rubyid_q_args'>q_args</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='op'>|</span> <span class='id identifier rubyid_hash'>hash</span><span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='id identifier rubyid_k'>k</span><span class='rbrace'>}</span>
    <span class='const'>RDF</span><span class='op'>::</span><span class='const'>Statement</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_stmt'>stmt</span><span class='rparen'>)</span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="relationships_will_change!-instance_method">
  
    - (<tt>Object</tt>) <strong>relationships_will_change!</strong> 
  

  

  
</h3><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


14
15
16</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File '/Users/ba2213/Github/cul/active_fedora_relsint/lib/active_fedora_relsint/datastream.rb', line 14</span>

<span class='kw'>def</span> <span class='id identifier rubyid_relationships_will_change!'>relationships_will_change!</span>
  <span class='id identifier rubyid_changed_attributes'>changed_attributes</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>relationships</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>nil</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="remove_relationship-instance_method">
  
    - (<tt>Object</tt>) <strong>remove_relationship</strong>(datastream, predicate, target, literal = false) 
  

  

  
</h3><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


70
71
72
73
74</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File '/Users/ba2213/Github/cul/active_fedora_relsint/lib/active_fedora_relsint/datastream.rb', line 70</span>

<span class='kw'>def</span> <span class='id identifier rubyid_remove_relationship'>remove_relationship</span><span class='lparen'>(</span><span class='id identifier rubyid_datastream'>datastream</span><span class='comma'>,</span> <span class='id identifier rubyid_predicate'>predicate</span><span class='comma'>,</span> <span class='id identifier rubyid_target'>target</span><span class='comma'>,</span> <span class='id identifier rubyid_literal'>literal</span><span class='op'>=</span><span class='kw'>false</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_stmt'>stmt</span> <span class='op'>=</span> <span class='id identifier rubyid_build_statement'>build_statement</span><span class='lparen'>(</span><span class='id identifier rubyid_datastream'>datastream</span><span class='comma'>,</span> <span class='id identifier rubyid_predicate'>predicate</span><span class='comma'>,</span> <span class='id identifier rubyid_target'>target</span><span class='comma'>,</span> <span class='id identifier rubyid_literal'>literal</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_graph'>graph</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_stmt'>stmt</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_relationships_will_change!'>relationships_will_change!</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="serialize!-instance_method">
  
    - (<tt>Object</tt>) <strong>serialize!</strong> 
  

  

  
</h3><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


9
10
11
12</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File '/Users/ba2213/Github/cul/active_fedora_relsint/lib/active_fedora_relsint/datastream.rb', line 9</span>

<span class='kw'>def</span> <span class='id identifier rubyid_serialize!'>serialize!</span>
  <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_content'>content</span> <span class='op'>=</span> <span class='id identifier rubyid_to_rels_int'>to_rels_int</span><span class='lparen'>(</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_changed_attributes'>changed_attributes</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>relationships</span><span class='tstring_end'>'</span></span>
  <span class='id identifier rubyid_changed_attributes'>changed_attributes</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>relationships</span><span class='tstring_end'>'</span></span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="solrize_relationships-instance_method">
  
    - (<tt>Object</tt>) <strong>solrize_relationships</strong>(solr_doc = Hash.new) 
  

  

  
</h3><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


129
130
131
132
133
134
135
136
137
138
139
140
141</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File '/Users/ba2213/Github/cul/active_fedora_relsint/lib/active_fedora_relsint/datastream.rb', line 129</span>

<span class='kw'>def</span> <span class='id identifier rubyid_solrize_relationships'>solrize_relationships</span><span class='lparen'>(</span><span class='id identifier rubyid_solr_doc'>solr_doc</span><span class='op'>=</span><span class='const'>Hash</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_rel_hash'>rel_hash</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span> <span class='comment'># the rels_int_profile is a hash of hashes in json
</span>  <span class='id identifier rubyid_graph'>graph</span><span class='period'>.</span><span class='id identifier rubyid_each_statement'>each_statement</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_statement'>statement</span><span class='op'>|</span>
    <span class='id identifier rubyid_predicate'>predicate</span> <span class='op'>=</span> <span class='const'>ActiveFedora</span><span class='op'>::</span><span class='const'>RelsExtDatastream</span><span class='period'>.</span><span class='id identifier rubyid_short_predicate'>short_predicate</span><span class='lparen'>(</span><span class='id identifier rubyid_statement'>statement</span><span class='period'>.</span><span class='id identifier rubyid_predicate'>predicate</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_literal'>literal</span> <span class='op'>=</span> <span class='id identifier rubyid_statement'>statement</span><span class='period'>.</span><span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_kind_of?'>kind_of?</span><span class='lparen'>(</span><span class='const'>RDF</span><span class='op'>::</span><span class='const'>Literal</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_val'>val</span> <span class='op'>=</span> <span class='id identifier rubyid_literal'>literal</span> <span class='op'>?</span> <span class='id identifier rubyid_statement'>statement</span><span class='period'>.</span><span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_value'>value</span> <span class='op'>:</span> <span class='id identifier rubyid_statement'>statement</span><span class='period'>.</span><span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_to_str'>to_str</span>
    <span class='id identifier rubyid_rel_hash'>rel_hash</span><span class='lbracket'>[</span><span class='id identifier rubyid_statement'>statement</span><span class='period'>.</span><span class='id identifier rubyid_subject'>subject</span><span class='rbracket'>]</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
    <span class='id identifier rubyid_rel_hash'>rel_hash</span><span class='lbracket'>[</span><span class='id identifier rubyid_statement'>statement</span><span class='period'>.</span><span class='id identifier rubyid_subject'>subject</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='id identifier rubyid_predicate'>predicate</span><span class='rbracket'>]</span> <span class='op'>||=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
    <span class='id identifier rubyid_rel_hash'>rel_hash</span><span class='lbracket'>[</span><span class='id identifier rubyid_statement'>statement</span><span class='period'>.</span><span class='id identifier rubyid_subject'>subject</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='id identifier rubyid_predicate'>predicate</span><span class='rbracket'>]</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_val'>val</span>
  <span class='kw'>end</span>
  <span class='id identifier rubyid_solr_doc'>solr_doc</span><span class='lbracket'>[</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_profile_solr_name'>profile_solr_name</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_rel_hash'>rel_hash</span><span class='period'>.</span><span class='id identifier rubyid_to_json'>to_json</span> <span class='kw'>unless</span> <span class='id identifier rubyid_rel_hash'>rel_hash</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
  <span class='id identifier rubyid_solr_doc'>solr_doc</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="to_predicate-instance_method">
  
    - (<tt>Object</tt>) <strong>to_predicate</strong>(arg) 
  

  

  
</h3><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


46
47
48
49
50
51
52
53
54
55</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File '/Users/ba2213/Github/cul/active_fedora_relsint/lib/active_fedora_relsint/datastream.rb', line 46</span>

<span class='kw'>def</span> <span class='id identifier rubyid_to_predicate'>to_predicate</span><span class='lparen'>(</span><span class='id identifier rubyid_arg'>arg</span><span class='rparen'>)</span>
  <span class='kw'>return</span> <span class='symbol'>:p</span> <span class='kw'>if</span> <span class='id identifier rubyid_arg'>arg</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
  <span class='kw'>if</span> <span class='id identifier rubyid_arg'>arg</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'>Symbol</span>
    <span class='id identifier rubyid_arg'>arg</span> <span class='op'>=</span> <span class='const'>ActiveFedora</span><span class='op'>::</span><span class='const'>Predicates</span><span class='period'>.</span><span class='id identifier rubyid_find_graph_predicate'>find_graph_predicate</span><span class='lparen'>(</span><span class='id identifier rubyid_arg'>arg</span><span class='rparen'>)</span>
  <span class='kw'>elsif</span> <span class='id identifier rubyid_arg'>arg</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'>RDF</span><span class='op'>::</span><span class='const'>Resource</span>
    <span class='id identifier rubyid_arg'>arg</span>
  <span class='kw'>else</span>
    <span class='const'>RDF</span><span class='op'>::</span><span class='const'>URI</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_arg'>arg</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="to_rels_int-instance_method">
  
    - (<tt>Object</tt>) <strong>to_rels_int</strong> 
  

  

  
</h3><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


107
108
109
110
111
112
113</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File '/Users/ba2213/Github/cul/active_fedora_relsint/lib/active_fedora_relsint/datastream.rb', line 107</span>

<span class='kw'>def</span> <span class='id identifier rubyid_to_rels_int'>to_rels_int</span>
  <span class='id identifier rubyid_xml'>xml</span> <span class='op'>=</span> <span class='const'>ActiveFedora</span><span class='op'>::</span><span class='const'>RDFXMLWriter</span><span class='period'>.</span><span class='id identifier rubyid_buffer'>buffer</span><span class='lparen'>(</span><span class='symbol'>:max_depth</span><span class='op'>=&gt;</span><span class='int'>1</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_writer'>writer</span><span class='op'>|</span>
    <span class='id identifier rubyid_writer'>writer</span><span class='period'>.</span><span class='id identifier rubyid_prefixes'>prefixes</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span> <span class='const'>ActiveFedora</span><span class='op'>::</span><span class='const'>Predicates</span><span class='period'>.</span><span class='id identifier rubyid_predicate_namespaces'>predicate_namespaces</span>
    <span class='id identifier rubyid_writer'>writer</span><span class='period'>.</span><span class='id identifier rubyid_write_graph'>write_graph</span><span class='lparen'>(</span><span class='id identifier rubyid_graph'>graph</span><span class='rparen'>)</span>
  <span class='kw'>end</span>
  <span class='id identifier rubyid_xml'>xml</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="to_resource-instance_method">
  
    - (<tt>Object</tt>) <strong>to_resource</strong>(object, literal = false) 
  

  

  
</h3><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


32
33
34
35
36
37
38
39
40
41
42
43
44</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File '/Users/ba2213/Github/cul/active_fedora_relsint/lib/active_fedora_relsint/datastream.rb', line 32</span>

<span class='kw'>def</span> <span class='id identifier rubyid_to_resource'>to_resource</span><span class='lparen'>(</span><span class='id identifier rubyid_object'>object</span><span class='comma'>,</span> <span class='id identifier rubyid_literal'>literal</span><span class='op'>=</span><span class='kw'>false</span><span class='rparen'>)</span>
  <span class='kw'>if</span> <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'>ActiveFedora</span><span class='op'>::</span><span class='const'>Datastream</span>
    <span class='const'>RDF</span><span class='op'>::</span><span class='const'>URI</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>info:fedora/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_pid'>pid</span><span class='rbrace'>}</span><span class='tstring_content'>/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_dsid'>dsid</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
  <span class='kw'>elsif</span> <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span> <span class='symbol'>:internal_uri</span>
    <span class='const'>RDF</span><span class='op'>::</span><span class='const'>URI</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_internal_uri'>internal_uri</span><span class='rparen'>)</span>
  <span class='kw'>elsif</span> <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'>RDF</span><span class='op'>::</span><span class='const'>Resource</span>
    <span class='id identifier rubyid_object'>object</span>
  <span class='kw'>elsif</span> <span class='id identifier rubyid_literal'>literal</span>
    <span class='const'>RDF</span><span class='op'>::</span><span class='const'>Literal</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_object'>object</span><span class='rparen'>)</span>
  <span class='kw'>else</span>
    <span class='const'>RDF</span><span class='op'>::</span><span class='const'>URI</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="to_solr-instance_method">
  
    - (<tt>Object</tt>) <strong>to_solr</strong>(solr_doc = Hash.new) 
  

  

  
</h3><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


119
120
121
122
123</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File '/Users/ba2213/Github/cul/active_fedora_relsint/lib/active_fedora_relsint/datastream.rb', line 119</span>

<span class='kw'>def</span> <span class='id identifier rubyid_to_solr'>to_solr</span><span class='lparen'>(</span><span class='id identifier rubyid_solr_doc'>solr_doc</span><span class='op'>=</span><span class='const'>Hash</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='kw'>super</span><span class='lparen'>(</span><span class='id identifier rubyid_solr_doc'>solr_doc</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='id identifier rubyid_solrize_relationships'>solrize_relationships</span><span class='lparen'>(</span><span class='id identifier rubyid_result'>result</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_result'>result</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

</div>

    <div id="footer">
  Generated on Thu Jan 24 11:22:14 2013 by
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
  0.8.2.1 (ruby-1.9.3).
</div>

  </body>
</html>